# 计算一个数的阶乘

def factorial(n):
    if n == 0:
        return 1
    else:
        return n * factorial(n-1)
    

# 不用递归的写法
def xunhuan(n):
    result = 1
    for i in range(1, n+1):
        result *= i
    return result
    
num = int(input("请输入一个数字："))
print("该数的阶乘为：", factorial(num))

num = int(input("请输入一个数字："))
print("该数的阶乘为：", xunhuan(num))
